package com.example.demo.service;

import com.example.demo.dao.BorrowDao;
import com.example.demo.entity.BorrowEntity;
import com.example.demo.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BorrowService {
    @Autowired
    private BorrowDao borrowDao;
    /**
     * 通过ID查询单条数据
     */
    public BorrowEntity queryBorrowById(Integer borid){
        return borrowDao.queryBorrowById(borid);
    }

    /**
     * 通过实体类查询单条数据
     */
    public BorrowEntity queryBorrowByUid(int uid){
        return borrowDao.queryBorrowByUid(uid);
    }
    /**
     * 通过uid查询多条数据
     */
    public List<BorrowEntity> queryBorrowByUidList(int uid){
        return borrowDao.queryBorrowByUidList(uid);
    }

    /**
     * 查询多条数据
     */
    public List<BorrowEntity> queryBorrowAll(){
       return borrowDao.queryBorrowAll();
    }

    /**
     * 新增数据
     */
    public int insertBorrow(BorrowEntity borrow){
        return borrowDao.insertBorrow(borrow);
    }

    /**
     * 修改数据
     */
    public void updateBorrow(BorrowEntity borrow){
        borrowDao.updateBorrow(borrow);
    }

    /**
     * 通过主键删除数据
     */
    public void deleteByIdBorrow(Integer borid){
        borrowDao.deleteByIdBorrow(borid);
    }

}